package state.group;

import static org.junit.Assert.*;

import org.junit.Test;

public class HallCallTest {

    @Test
    public void testEquals()
    {
        HallCall call1 = new HallCall((byte) 20, ElevatorStruct.DOWN);
        HallCall call2 = new HallCall((byte) 20, ElevatorStruct.DOWN);
        HallCall call3 = new HallCall((byte) 20, ElevatorStruct.UP);
        HallCall call4 = new HallCall((byte) 10, ElevatorStruct.DOWN);
        
        assertEquals(call1, call1);
        
        assertEquals(call1, call2);
        assertEquals(call2, call1);
        
        assertFalse(call1.equals(call3));
        assertFalse(call3.equals(call1));
        
        assertFalse(call1.equals(call4));
        assertFalse(call4.equals(call1));
        
        assertFalse(call3.equals(call4));
        assertFalse(call4.equals(call3));
    }
    
    @Test
    public void testHashCode()
    {
        
        HallCall call1 = new HallCall((byte) 20, ElevatorStruct.DOWN);
        HallCall call2 = new HallCall((byte) 20, ElevatorStruct.DOWN);
        HallCall call3 = new HallCall((byte) 20, ElevatorStruct.UP);
        HallCall call4 = new HallCall((byte) 10, ElevatorStruct.DOWN);
        
        assertEquals(call1.hashCode(), call1.hashCode());
        
        assertEquals(call1.hashCode(), call2.hashCode());
        
        assertFalse(call1.hashCode() == call3.hashCode());
        
        assertFalse(call1.hashCode() == call4.hashCode());
        
        assertFalse(call3.hashCode() == call4.hashCode());
        
    }

}
